package priv.lhy.feign.configuration;

import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static java.util.concurrent.TimeUnit.SECONDS;

/**
 * @author: lihy
 * date: 2019/10/31 16:36
 * description: 配置feign重试
 * feign默认不重试，这里配置为重试间隔为 100ms，最大重试时间为 1s, 重试次数为 5 次(包括第一次)
 */
@Configuration
public class FeignConfiguration {

    @Bean
    public Retryer feignRetryer(){
        return new Retryer.Default(10, 50, 3);
    }
}
